//
//  MCDistributionPageViewController.swift
//  StoreManage
//
//  Created by MC on 2018/6/22.
//  Copyright © 2018年 MC. All rights reserved.
//

import UIKit

class MCDistributionPageViewController: MCPageViewController {

    
    private var navBarHairLineImageView : UIImageView?

    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        navBarHairLineImageView?.isHidden = true
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        navBarHairLineImageView?.isHidden = false
    }

    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        baseSetting()
        
        initUI()
    }
    // MARK: - Action
    @objc func leftItemClicked() {
        self.navigationController?.popViewController(animated: true)
    }
    
    // MARK: - Method
    func baseSetting() {
        self.title = "我的分销"
        self.view.backgroundColor = UIColor.white
        
        navigationItem.leftBarButtonItem = MCSetBarButtonItem_image(#imageLiteral(resourceName: "Reuse_back"), target: self, selector: #selector(leftItemClicked),isLeft: true)

        
        navBarHairLineImageView = MCFindNavigationBarLine(view: (navigationController?.navigationBar)!)
    }
    
    func initUI() {
        let vcOne = MCDistributionViewController()
        vcOne.marketingType = 0
        vcOne.closure = { vc  in
            MCPushToViewController(current: self, target: vc, isHiddenBottomBarWhenBack: true)
        }
        
        let vcTwo = MCDistributionViewController()
        vcTwo.marketingType = 1
        self.initWithTitleArray(["进行中","已完成"], vcArray: [vcOne,vcTwo], blockNormalColor: UIColor.MCGray_middle, blockSelectedColor: UIColor.MCMain, currentPage: 0)
        
    }    
}
